package com.wjq.service;

import com.wjq.entity.Choice;
import com.wjq.mapper.ChoiceMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ChoiceServiceImpl implements ChoiceService{

    @Autowired
    private ChoiceMapper choiceMapper;

    /**
     *问题id
     * @param
     * @return 这个问题所有选项
     */
    @Override
    public List<Choice> getChoices(Integer id){
        List<Choice> choices = choiceMapper.queryChoiceList(id);
        return choices;
    }

    @Override
    public void addChoice(Choice choice) {
        choiceMapper.addChoice(choice);
    }

    @Override
    public void updateChoice(Choice choice) {
        choiceMapper.updateChoice(choice);
    }

    @Override
    public void deleteChoice(Integer id) {
        choiceMapper.deleteChoiceById(id);
    }
}
